import request from '@/utils/request'
// 获取列表
export function listData(query) {
    return request({
      url: '/ai/dataset/list',
      method: 'get',
      params: query
    })
  }
//   添加数据集 /ai/dataset/create
export function addData(data) {
    return request({
      url: '/ai/dataset/create',
      method: 'post',
      data: data
    })
  }
//   移除数据集/ai/dataset/remove
export function deleteData(id) {
    return request({
      url: '/ai/dataset/remove/' + id ,
      method: 'delete',
    })
  }
//   更新数据集 /ai/dataset/update
export function updateData(data) {
    return request({
      url: '/ai/dataset/update/' + data.dataset_id,
      method: 'put',
      data:data
    })
  }
  // 获取知识库配置
  export function getConfig(query) {
    return request({
      url: '/ai/dataset/info',
      method: 'get',
      params: query
    })
  }
  // 获取知识库配置项列表
  export function getConfigList() {
    return request({
      url: '/ai/dataset/config',
      method: 'get'
    })
  }
  
// 文档列表
export function listFile(query) {
  return request({
    url: '/ai/dataset/list/document',
    method: 'get',
    params: query
  })
}
// 更新文档
export function updateFile(data) {
  return request({
    url: '/ai/dataset/update/document/' + data.document_id,
    method: 'put',
    data: data
  })
}
// 删除file
export function deleteFile(data) {
  return request({
    url: '/ai/dataset/remove/document',
    method: 'delete',
    data: data
  })
}
// 下载文档
export function downFile(document_id) {
  return request({
    url: `/ai/dataset/download/document/${document_id}`,
    method: 'get'
  })
}

// 解析方法
export function parseDocument(data) {
  return request({
    url: '/ai/dataset/start/document',
    method: 'post',
    data: data
  })
}
// 停止解析 /ai/dataset/stop/document

export function parseStop(data) {
  return request({
    url: '/ai/dataset/stop/document',
    method: 'post',
    data: data
  })
}
// 读取解析状态
export function getParseStatus(data) {
  return request({
    url: '/ai/dataset/list/document',
    method: 'get',
    params: data
  })
}
// 新增chunk
export function addChunk(data) {
  return request({
    url: '/ai/dataset/chunk/add',
    method: 'post',
    data: data
  })
}
// 检索chunk
export function searchChunk(data) {
  return request({
    url: '/ai/dataset/chunk/retrieval',
    method: 'post',
    data: data
  })
}
// 更新chunk
export function updateChunk(data) {
  return request({
    url: '/ai/dataset/chunk/update',
    method: 'put',
    data: data
  })
}
// 删除chunk
export function deleteChunk(data) {
  return request({
    url: '/ai/dataset/chunk/remove',
    method: 'delete',
    data: data
  })
}
// chunk列表
export function listChunk(data) {
  return request({
    url: '/ai/dataset/chunk/list',
    method: 'get',
    params: data
  })
}
